<style>
    .pageFormContent dd {
    display: block;
    float: none;
    line-height: 21px;
    width: 620px;
}
</style>
<script type="text/javascript">
function getUser(){
    var parent=$("#uname").val();
    var url="{:U('Bizbase/ajax_users')}";
     $.ajax({
        type: "POST",
        url:url,
        data: {parent:parent},
        dataType: "json",
        success:function(data){
            if(data.status==1){
                $(".info").each(function () {
                    $("#"+$(this).attr('id')).val(data.info[$(this).attr('id')]);
                });
                //area_change(0, 0,'province','city','area',data.info.province,data.info.city,data.info.area,'/agent.php');
                var username = data.info.username?" 用户名：" + data.info.username:'';
                var email = data.info.email?" 信箱：" + data.info.email:'';
                var mobile = data.info.mobile?" 手机：" +data.info.mobile:'';
                $("#userinfo").text(username + email + mobile);
                $('#edit-profile').attr("action", "{:U('Bizbase/cloudclientadd')}");
            }else if(data.status==2){
                //更新云购店信息，设置开通云购平台
                $("#userinfo").text("当前云购信息可关联开通云购平台.");
                $('#edit-profile').attr("action", "{:U('Bizbase/cloudclientedit')}");
                $(".info").each(function () {
                    $("#"+$(this).attr('id')).val(data.info[$(this).attr('id')]);
                    if($(this).attr('id') == 'pay_status'){
                        $("#"+$(this).attr('id')).attr("value",data.info[$(this).attr('id')]);
                    }
                });
                //area_change(0, 0,'province','city','area',data.info.province,data.info.city,data.info.area,'/agent.php');
            }else if(data.status==0){                
                $("#userinfo").html("云采购帐户不存在.请先注册&nbsp;&nbsp;&nbsp;&nbsp;<a href='{:U('Bizbase/reg')}&username="+parent+"' rel='Bizbase_reg' title='注册云采购帐户' width='560' height='300' lookupGroup='org1'>注册云采购帐户</a>");
                $('#edit-profile').attr("action", "{:U('Bizbase/cloudclientadd')}");
                //dialog();
                $(".info").each(function () {
                    $("#"+$(this).attr('id')).val(data.info[$(this).attr('id')]);
                });
                //area_change(0, 0,'province','city','area',data.info.province,data.info.city,data.info.area,'/agent.php');
            }else if(data.status==3){
                $("#userinfo").html("当前用户不适用开通云购平台.");
                $('#edit-profile').attr("action", "{:U('Bizbase/cloudclientadd')}");
                $(".info").each(function () {
                    $("#"+$(this).attr('id')).val(data.info[$(this).attr('id')]);
                });
                //area_change(0, 0,'province','city','area',data.info.province,data.info.city,data.info.area,'/agent.php');
            }else{
                $("#userinfo").html("请填写云采购帐户.没有帐户请先注册&nbsp;&nbsp;&nbsp;&nbsp;<a href='{:U('Bizbase/reg')}&username="+parent+"' rel='Bizbase_reg' title='注册云采购帐户' width='560' height='300' lookupGroup='org1'>注册云采购帐户</a>");
                $('#edit-profile').attr("action", "{:U('Bizbase/cloudclientadd')}");
                //dialog();
                $(".info").each(function () {
                    $("#"+$(this).attr('id')).val(data.info[$(this).attr('id')]);
                });
                //area_change(0, 0,'province','city','area',data.info.province,data.info.city,data.info.area,'/agent.php');
            }
            initUI($("#userinfo"));
        }
    });
}
    
</script>
<div class="pageContent">
    <form id="edit-profile" method="post" action="{:U('Bizbase/cloudclientadd')}" onsubmit="return validateCallback(this,dialogAjaxDone);">
    	<div class="tabsContent">
            <div class="pageFormContent" layouth="680">
                <dl>
                    <dt>云采购帐号：</dt>
                    <dd>
                        <input type="text" class="required" id="uname" value="" name="org1.orgName" onblur="getUser();" suggestFields="orgName" /><input  id="user_id" class="info" name="user_biz[user_id]" type="hidden" />
                        <p id="userinfo">请填写云采购帐户.没有帐户请先注册&nbsp;&nbsp;&nbsp;&nbsp;<a href="{:U('Bizbase/reg')}" rel="Bizbase_reg" title="注册云采购帐户"  width="560" height="300" lookupGroup="org1">注册云采购帐户</a></p>
                    </dd>
                </dl>
            </div>
            <div class="pageFormContent" layouth="130">
        		<!--<dl>
        			<dt>用户编号：</dt>
        			<dd>{$info[user_id]}<input id="id" name="user_biz[user_id]" type="hidden" value="{$user_biz[user_id]}"/></dd>
        		</dl>-->
        		<dl>
        			<dt>商家类型：</dt>
        			<dd>
        			    <label><input type="radio" name="user_biz[stype]" value="1" {if $user_biz[stype]==1} checked="checked" {/if} />云购商</label>
                        <label><input type="radio" name="user_biz[stype]" value="2" {if $user_biz[stype]==2} checked="checked" {/if} />云购店</label>    
        			</dd>
        		</dl>
        		<dl>
        			<dt>商家名称：</dt>
        			<dd>
        			   <input type="text" class="required" id="company" name="user_biz[company]" value="{$user_biz[company]}" /> 
    			    </dd>
        		</dl>
        		<dl>
                    <dt>联系人：</dt>
                    <dd>
                        <input type="text" class="required" id="realname" name="user_biz[realname]" value="{$user_biz[realname]}" />
                    </dd>
                </dl>
        		<dl>
        			<dt>所属区域：</dt>
        			<dd>
        			    <select name="user_biz[province]" ref="citys" refUrl="{:U('Bizbase/area')}&id={value}&level=2" class="combox">
                            <option value="all">请选择省份...</option>
                            <volist name="Area_list" id="vo">
                                {if $vo['parentid'] == 0}
                                <option value="{$vo['id']}" {if $user_biz[province]==$vo['id']}selected="selected"{/if}>{$vo['name']}</option>
                                {/if}
                            </volist>
                          </select>
                          <select name="user_biz[city]" ref="areas" refUrl="{:U('Bizbase/area')}&id={value}&level=3" id="citys" class="combox">
                            <option value="all">请选择城市...</option>
                          </select>
                          <select name="user_biz[area]" id="areas" class="combox">
                            <option value="all">请选择区域...</option>
                          </select>
                          <input type="text" class="required" id="address" name="user_biz[address]" value="{$user_biz[address]}" />
        			</dd>
        		</dl>
        		<dl>
        			<dt>商家邮编：</dt>
        			<dd>
        			    <input type="text" class="input-text" id="zipcode" name="user_biz[zipcode]" value="{$user_biz[zipcode]}" />
        			</dd>
        		</dl>
        		<dl>
        			<dt>商家电话：</dt>
        			<dd><input name="user_biz[tel]" class="input-text" type="text" value="{$user_biz[tel]}" size="15" alt="请输入电话"/></dd>
        		</dl>
        		<dl>
        			<dt>商家手机：</dt>
        			<dd><input name="user_biz[mobile]" class="required" type="text" value="{$user_biz[mobile]}" size="15" alt="请输入手机"/></dd>
        		</dl>
        		<dl class="nowrap">
                    <dt>商家简介：</dt>
                    <dd><textarea name="user_biz[about]" cols="30" rows="2">{$user_biz[about]}</textarea></dd>
                </dl>
        		<dl>
                    <dt>合约开始时间：</dt>
                    <dd><input name="user_biz[starttime]" class="date" type="text" value="<php>if(!empty($user_biz['starttime'])&&$user_biz['starttime']>0){</php>{$user_biz['starttime']|date='Y-m-d H:i:s',###}<php>}else{</php>{$showtime=date('Y-m-d')}<php>}</php>"/><a class="inputDateButton" href="javascript:;">选择</a><span class="info">yyyy-MM-dd</span></dd>
                </dl>
                <dl>
                    <dt>合约结束时间：</dt>
                    <dd><input name="user_biz[endtime]" class="date" type="text" value="<php>if(!empty($user_biz['endtime'])&&$user_biz['endtime']>0){</php>{$user_biz['endtime']|date='Y-m-d H:i:s',###}<php>}else{</php>{$showtime=date('Y-m-d')}<php>}</php>"/><a class="inputDateButton" href="javascript:;">选择</a><span class="info">yyyy-MM-dd</span></dd>
                </dl>
                <dl>
                    <dt>申请时间：</dt>
                    <dd>{$user_biz["createtime"] ? $user_biz["createtime"]|date='Y-m-d H:m:s',###:""}</dd>
                </dl>
                <dl>
                    <dt>付款状态：</dt>
                    <dd>
                        <select name="user_biz[pay_status]" id="pay_status" class="combox" >
                            <option value="0" {if $user_biz[pay_status]==0}selected="selected"{/if}>未付款 </option>
                            <option value="3" {if $user_biz[pay_status]==3}selected="selected"{/if}>付款中 </option>
                            <option value="5" {if $user_biz[pay_status]==5}selected="selected"{/if}>线下已付款</option>
                        </select> 
                    </dd>
                </dl>
                <dl>
                    <dt>审核状态：</dt>
                    <dd>
                        <select name="user_biz[status]" id="status" class="combox" >
                            <option value="0" {if $user_biz[status]==0}selected="selected"{/if}>未审核  </option>
                            <option value="1" {if $user_biz[status]==1}selected="selected"{/if}>审核未通过 </option>
                            <option value="2" {if $user_biz[status]==2}selected="selected"{/if}>审核通过</option>
                        </select>
                    </dd>
                </dl>
                 <dl>
                    <dt>开通状态：</dt>
                    <dd>
                        <select name="user_biz[isclose]" id="isclose" class="combox" >
                            <option value="0" {if $user_biz[isclose]==0}selected="selected"{/if}>未开通</option>
                            <option value="1" {if $user_biz[isclose]==1}selected="selected"{/if}>关闭云购店</option>
                            <option value="2" {if $user_biz[isclose]==2}selected="selected"{/if}>开通云购店</option>
                        </select>
                    </dd>
                </dl>
                <dl class="nowrap">
                    <dt>备注：</dt>
                    <dd><textarea name="user_biz[remark]" cols="30" rows="2">{$user_biz[remark]}</textarea></dd>
                </dl>
            </div>
    	</div>
    	<div class="formBar">
            <ul>
                <li><div class="buttonActive"><div class="buttonContent"><input id="dosubmit" name="dosubmit" type="hidden" value="1"/><button type="submit">保存</button></div></div></li>
                <li>
                    <div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div>
                </li>
            </ul>
        </div>
        <div class="tabsFooter">
            <div class="tabsFooterContent"></div>
        </div>
    </form>
</div>